import unittest
import time
from HTMLTestRunner_PY3 import HTMLTestRunner
if __name__ == '__main__':
    # 批量加载
    runtest_dir=r'../test_case'
    discover=unittest.defaultTestLoader.discover(runtest_dir,pattern='test*.py')
    # 拼装测试报告文件
    report_dir=r'../reports'
    now = time.strftime('%Y_%m_%d_%H_%M_%S')
    report_name=rf'{report_dir}/{now}HTML_PY3.html'
    #执行并声称测试报告
    with open(report_name,'wb') as f:
        runner=HTMLTestRunner(f,title='测试报告PY3',description='测试详情')
        runner.run(discover)